{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ex1 - Filtering and Sorting Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This time we are going to pull data directly from the internet.\n",
    "Special thanks to: https://github.com/justmarkham for sharing the dataset and materials.\n",
    "\n",
    "### Step 1. Import the necessary libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv). "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 3. Assign it to a variable called chipo."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv'\n",
    "\n",
    "chipo = pd.read_csv(url, sep = '\\t')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 4. How many products cost more than $10.00?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "12"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# clean the item_price column and transform it in a float\n",
    "prices = [float(value[1 : -1]) for value in chipo.item_price]\n",
    "\n",
    "# reassign the column with the cleaned prices\n",
    "chipo.item_price = prices\n",
    "\n",
    "# delete the duplicates in item_name and quantity\n",
    "chipo_filtered = chipo.drop_duplicates(['item_name','quantity'])\n",
    "\n",
    "# select only the products with quantity equals to 1\n",
    "chipo_one_prod = chipo_filtered[chipo_filtered.quantity == 1]\n",
    "\n",
    "chipo_one_prod[chipo_one_prod['item_price']>10].item_name.nunique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 5. What is the price of each item? \n",
    "###### print a data frame with only two columns item_name and item_price"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>order_id</th>\n",
       "      <th>quantity</th>\n",
       "      <th>item_name</th>\n",
       "      <th>choice_description</th>\n",
       "      <th>item_price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa (Mild), [Rice, Cheese, Sou...</td>\n",
       "      <td>10.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Fajita Vegetables...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa (Medium), [Pinto Bea...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Black Beans,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>34</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Pinto...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>34</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>44</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Rice, Fajita Vege...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Rice, Black Beans...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>54</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Guacamole, Cheese, Sour ...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>138</th>\n",
       "      <td>62</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Fajita Vegetables,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>63</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Sour Crea...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>64</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>160</th>\n",
       "      <td>73</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa (Mild), [Black Beans, Rice...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>79</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa (Medium), [Black Bea...</td>\n",
       "      <td>10.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>182</th>\n",
       "      <td>82</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Sour ...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>86</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Cheese, Sour Cream]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>89</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[[Roasted Chili Corn Salsa (Medium), Tomatillo...</td>\n",
       "      <td>10.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>206</th>\n",
       "      <td>92</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Cheese, Lettuce]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>209</th>\n",
       "      <td>93</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>211</th>\n",
       "      <td>93</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>218</th>\n",
       "      <td>96</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Black Bea...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>220</th>\n",
       "      <td>97</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Black Beans,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>98</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Pinto Bea...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>231</th>\n",
       "      <td>102</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>252</th>\n",
       "      <td>110</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Rice, Cheese, Let...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257</th>\n",
       "      <td>111</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Cheese]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>284</th>\n",
       "      <td>124</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Cheese, Sour Cream]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>290</th>\n",
       "      <td>126</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>291</th>\n",
       "      <td>127</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Sour Crea...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4443</th>\n",
       "      <td>1771</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Pinto Bea...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4444</th>\n",
       "      <td>1771</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Sour ...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4465</th>\n",
       "      <td>1779</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Cheese]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4481</th>\n",
       "      <td>1786</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, Rice]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4483</th>\n",
       "      <td>1786</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Pinto Beans, Chees...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4484</th>\n",
       "      <td>1786</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4486</th>\n",
       "      <td>1786</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4488</th>\n",
       "      <td>1786</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4495</th>\n",
       "      <td>1788</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Pinto Beans, Sour ...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4498</th>\n",
       "      <td>1789</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Fajita Vegetabl...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4506</th>\n",
       "      <td>1792</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Cheese, Sour Cream...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4511</th>\n",
       "      <td>1794</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Fajita Veget...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4532</th>\n",
       "      <td>1802</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Black Beans,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4537</th>\n",
       "      <td>1804</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4540</th>\n",
       "      <td>1805</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Fajita Vegetabl...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4553</th>\n",
       "      <td>1810</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Black Beans, Sour ...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4555</th>\n",
       "      <td>1811</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4564</th>\n",
       "      <td>1815</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4574</th>\n",
       "      <td>1819</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Cheese, Lett...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4576</th>\n",
       "      <td>1820</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Cheese, Sour Cream...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4581</th>\n",
       "      <td>1822</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Rice, Black Beans...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4583</th>\n",
       "      <td>1823</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Black Bea...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4586</th>\n",
       "      <td>1824</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4587</th>\n",
       "      <td>1824</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4589</th>\n",
       "      <td>1825</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Sour ...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4590</th>\n",
       "      <td>1825</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Rice, Black Beans,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4591</th>\n",
       "      <td>1825</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Rice, Black Beans...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4595</th>\n",
       "      <td>1826</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Rice, Black Bea...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4599</th>\n",
       "      <td>1827</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Cheese, Lettuce]]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4604</th>\n",
       "      <td>1828</td>\n",
       "      <td>1</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>693 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      order_id  quantity     item_name  \\\n",
       "5            3         1  Chicken Bowl   \n",
       "13           7         1  Chicken Bowl   \n",
       "19          10         1  Chicken Bowl   \n",
       "26          13         1  Chicken Bowl   \n",
       "42          20         1  Chicken Bowl   \n",
       "76          34         1  Chicken Bowl   \n",
       "78          34         1  Chicken Bowl   \n",
       "99          44         1  Chicken Bowl   \n",
       "110         49         1  Chicken Bowl   \n",
       "123         54         1  Chicken Bowl   \n",
       "138         62         1  Chicken Bowl   \n",
       "140         63         1  Chicken Bowl   \n",
       "142         64         1  Chicken Bowl   \n",
       "160         73         1  Chicken Bowl   \n",
       "176         79         1  Chicken Bowl   \n",
       "182         82         1  Chicken Bowl   \n",
       "193         86         1  Chicken Bowl   \n",
       "199         89         1  Chicken Bowl   \n",
       "206         92         1  Chicken Bowl   \n",
       "209         93         1  Chicken Bowl   \n",
       "211         93         1  Chicken Bowl   \n",
       "218         96         1  Chicken Bowl   \n",
       "220         97         1  Chicken Bowl   \n",
       "224         98         1  Chicken Bowl   \n",
       "231        102         1  Chicken Bowl   \n",
       "252        110         1  Chicken Bowl   \n",
       "257        111         1  Chicken Bowl   \n",
       "284        124         1  Chicken Bowl   \n",
       "290        126         1  Chicken Bowl   \n",
       "291        127         1  Chicken Bowl   \n",
       "...        ...       ...           ...   \n",
       "4443      1771         1  Chicken Bowl   \n",
       "4444      1771         1  Chicken Bowl   \n",
       "4465      1779         1  Chicken Bowl   \n",
       "4481      1786         1  Chicken Bowl   \n",
       "4483      1786         1  Chicken Bowl   \n",
       "4484      1786         1  Chicken Bowl   \n",
       "4486      1786         1  Chicken Bowl   \n",
       "4488      1786         1  Chicken Bowl   \n",
       "4495      1788         1  Chicken Bowl   \n",
       "4498      1789         1  Chicken Bowl   \n",
       "4506      1792         1  Chicken Bowl   \n",
       "4511      1794         1  Chicken Bowl   \n",
       "4532      1802         1  Chicken Bowl   \n",
       "4537      1804         1  Chicken Bowl   \n",
       "4540      1805         1  Chicken Bowl   \n",
       "4553      1810         1  Chicken Bowl   \n",
       "4555      1811         1  Chicken Bowl   \n",
       "4564      1815         1  Chicken Bowl   \n",
       "4574      1819         1  Chicken Bowl   \n",
       "4576      1820         1  Chicken Bowl   \n",
       "4581      1822         1  Chicken Bowl   \n",
       "4583      1823         1  Chicken Bowl   \n",
       "4586      1824         1  Chicken Bowl   \n",
       "4587      1824         1  Chicken Bowl   \n",
       "4589      1825         1  Chicken Bowl   \n",
       "4590      1825         1  Chicken Bowl   \n",
       "4591      1825         1  Chicken Bowl   \n",
       "4595      1826         1  Chicken Bowl   \n",
       "4599      1827         1  Chicken Bowl   \n",
       "4604      1828         1  Chicken Bowl   \n",
       "\n",
       "                                     choice_description  item_price  \n",
       "5     [Fresh Tomato Salsa (Mild), [Rice, Cheese, Sou...       10.98  \n",
       "13    [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "19    [Tomatillo Red Chili Salsa, [Fajita Vegetables...        8.75  \n",
       "26    [Roasted Chili Corn Salsa (Medium), [Pinto Bea...        8.49  \n",
       "42    [Roasted Chili Corn Salsa, [Rice, Black Beans,...       11.25  \n",
       "76    [Fresh Tomato Salsa, [Rice, Black Beans, Pinto...        8.75  \n",
       "78    [Fresh Tomato Salsa, [Rice, Black Beans, Chees...        8.75  \n",
       "99    [Tomatillo Red Chili Salsa, [Rice, Fajita Vege...        8.75  \n",
       "110   [Tomatillo Red Chili Salsa, [Rice, Black Beans...        8.75  \n",
       "123   [Fresh Tomato Salsa, [Guacamole, Cheese, Sour ...       11.25  \n",
       "138   [Fresh Tomato Salsa, [Rice, Fajita Vegetables,...       11.25  \n",
       "140   [Tomatillo Green Chili Salsa, [Rice, Sour Crea...       11.25  \n",
       "142   [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "160   [Fresh Tomato Salsa (Mild), [Black Beans, Rice...        8.49  \n",
       "176   [Roasted Chili Corn Salsa (Medium), [Black Bea...       10.98  \n",
       "182   [Fresh Tomato Salsa, [Rice, Black Beans, Sour ...        8.75  \n",
       "193    [Fresh Tomato Salsa, [Rice, Cheese, Sour Cream]]        8.75  \n",
       "199   [[Roasted Chili Corn Salsa (Medium), Tomatillo...       10.98  \n",
       "206       [Fresh Tomato Salsa, [Rice, Cheese, Lettuce]]        8.75  \n",
       "209   [Roasted Chili Corn Salsa, [Fajita Vegetables,...       11.25  \n",
       "211   [Roasted Chili Corn Salsa, [Fajita Vegetables,...       11.25  \n",
       "218   [Tomatillo Green Chili Salsa, [Rice, Black Bea...        8.75  \n",
       "220   [Roasted Chili Corn Salsa, [Rice, Black Beans,...        8.75  \n",
       "224   [Tomatillo Green Chili Salsa, [Rice, Pinto Bea...        8.75  \n",
       "231   [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...        8.75  \n",
       "252   [Tomatillo Red Chili Salsa, [Rice, Cheese, Let...        8.75  \n",
       "257   [Fresh Tomato Salsa, [Rice, Black Beans, Cheese]]        8.75  \n",
       "284    [Fresh Tomato Salsa, [Rice, Cheese, Sour Cream]]        8.75  \n",
       "290   [Roasted Chili Corn Salsa, [Fajita Vegetables,...       11.25  \n",
       "291   [Tomatillo Green Chili Salsa, [Rice, Sour Crea...       11.25  \n",
       "...                                                 ...         ...  \n",
       "4443  [Tomatillo Green Chili Salsa, [Rice, Pinto Bea...        8.75  \n",
       "4444  [Fresh Tomato Salsa, [Rice, Black Beans, Sour ...        8.75  \n",
       "4465  [Fresh Tomato Salsa, [Rice, Black Beans, Cheese]]        8.75  \n",
       "4481                         [Fresh Tomato Salsa, Rice]        8.75  \n",
       "4483  [Fresh Tomato Salsa, [Rice, Pinto Beans, Chees...       11.25  \n",
       "4484  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "4486  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...       11.25  \n",
       "4488  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...        8.75  \n",
       "4495  [Fresh Tomato Salsa, [Rice, Pinto Beans, Sour ...       11.25  \n",
       "4498  [Tomatillo Green Chili Salsa, [Fajita Vegetabl...       11.25  \n",
       "4506  [Fresh Tomato Salsa, [Rice, Cheese, Sour Cream...       11.25  \n",
       "4511  [Roasted Chili Corn Salsa, [Rice, Fajita Veget...        8.75  \n",
       "4532  [Roasted Chili Corn Salsa, [Rice, Black Beans,...        8.75  \n",
       "4537  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...        8.75  \n",
       "4540  [Tomatillo Green Chili Salsa, [Fajita Vegetabl...       11.25  \n",
       "4553  [Roasted Chili Corn Salsa, [Black Beans, Sour ...       11.25  \n",
       "4555  [Roasted Chili Corn Salsa, [Fajita Vegetables,...        8.75  \n",
       "4564  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "4574  [Roasted Chili Corn Salsa, [Rice, Cheese, Lett...        8.75  \n",
       "4576  [Fresh Tomato Salsa, [Rice, Cheese, Sour Cream...       11.25  \n",
       "4581  [Tomatillo Red Chili Salsa, [Rice, Black Beans...        8.75  \n",
       "4583  [Tomatillo Green Chili Salsa, [Rice, Black Bea...        8.75  \n",
       "4586  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...       11.25  \n",
       "4587  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...       11.25  \n",
       "4589  [Fresh Tomato Salsa, [Rice, Black Beans, Sour ...       11.25  \n",
       "4590  [Roasted Chili Corn Salsa, [Rice, Black Beans,...       11.25  \n",
       "4591  [Tomatillo Red Chili Salsa, [Rice, Black Beans...        8.75  \n",
       "4595  [Tomatillo Green Chili Salsa, [Rice, Black Bea...        8.75  \n",
       "4599      [Roasted Chili Corn Salsa, [Cheese, Lettuce]]        8.75  \n",
       "4604  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...        8.75  \n",
       "\n",
       "[693 rows x 5 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# delete the duplicates in item_name and quantity\n",
    "# chipo_filtered = chipo.drop_duplicates(['item_name','quantity'])\n",
    "chipo[(chipo['item_name'] == 'Chicken Bowl') & (chipo['quantity'] == 1)]\n",
    "\n",
    "# select only the products with quantity equals to 1\n",
    "# chipo_one_prod = chipo_filtered[chipo_filtered.quantity == 1]\n",
    "\n",
    "# select only the item_name and item_price columns\n",
    "# price_per_item = chipo_one_prod[['item_name', 'item_price']]\n",
    "\n",
    "# sort the values from the most to less expensive\n",
    "# price_per_item.sort_values(by = \"item_price\", ascending = False).head(20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 6. Sort by the name of the item"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>order_id</th>\n",
       "      <th>quantity</th>\n",
       "      <th>item_name</th>\n",
       "      <th>choice_description</th>\n",
       "      <th>item_price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3389</th>\n",
       "      <td>1360</td>\n",
       "      <td>2</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>12.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>341</th>\n",
       "      <td>148</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1849</th>\n",
       "      <td>749</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1860</th>\n",
       "      <td>754</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2713</th>\n",
       "      <td>1076</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3422</th>\n",
       "      <td>1373</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>553</th>\n",
       "      <td>230</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1916</th>\n",
       "      <td>774</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1922</th>\n",
       "      <td>776</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1937</th>\n",
       "      <td>784</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3836</th>\n",
       "      <td>1537</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>298</th>\n",
       "      <td>129</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Sprite]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976</th>\n",
       "      <td>798</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1167</th>\n",
       "      <td>481</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3875</th>\n",
       "      <td>1554</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1124</th>\n",
       "      <td>465</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3886</th>\n",
       "      <td>1558</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2108</th>\n",
       "      <td>849</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3010</th>\n",
       "      <td>1196</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4535</th>\n",
       "      <td>1803</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Lemonade]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4169</th>\n",
       "      <td>1664</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4174</th>\n",
       "      <td>1666</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4527</th>\n",
       "      <td>1800</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4522</th>\n",
       "      <td>1798</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3806</th>\n",
       "      <td>1525</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Sprite]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2389</th>\n",
       "      <td>949</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3132</th>\n",
       "      <td>1248</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3141</th>\n",
       "      <td>1253</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Lemonade]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>639</th>\n",
       "      <td>264</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Diet Coke]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1026</th>\n",
       "      <td>422</td>\n",
       "      <td>1</td>\n",
       "      <td>6 Pack Soft Drink</td>\n",
       "      <td>[Sprite]</td>\n",
       "      <td>6.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2996</th>\n",
       "      <td>1192</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>[Roasted Chili Corn Salsa (Medium), [Black Bea...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3163</th>\n",
       "      <td>1263</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>[[Fresh Tomato Salsa (Mild), Roasted Chili Cor...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4084</th>\n",
       "      <td>1635</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>[[Fresh Tomato Salsa (Mild), Roasted Chili Cor...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1694</th>\n",
       "      <td>686</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>[[Fresh Tomato Salsa (Mild), Roasted Chili Cor...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2756</th>\n",
       "      <td>1094</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>[[Tomatillo-Green Chili Salsa (Medium), Roaste...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4201</th>\n",
       "      <td>1677</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Black...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1884</th>\n",
       "      <td>760</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>455</th>\n",
       "      <td>195</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3223</th>\n",
       "      <td>1289</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Fajita Vegetables...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2223</th>\n",
       "      <td>896</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, Fajita Vegetables]</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2269</th>\n",
       "      <td>913</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4541</th>\n",
       "      <td>1805</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Tomatillo Green Chili Salsa, [Fajita Vegetabl...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3293</th>\n",
       "      <td>1321</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Black Beans, Chees...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>83</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>960</th>\n",
       "      <td>394</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Lettu...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1316</th>\n",
       "      <td>536</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2156</th>\n",
       "      <td>869</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Fajita Vegetables...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4261</th>\n",
       "      <td>1700</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>295</th>\n",
       "      <td>128</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Lettu...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4573</th>\n",
       "      <td>1818</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Pinto...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2683</th>\n",
       "      <td>1066</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>496</th>\n",
       "      <td>207</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Fresh Tomato Salsa, [Rice, Lettuce, Guacamole...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4109</th>\n",
       "      <td>1646</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Salad Bowl</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Fajita Vegetables...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>738</th>\n",
       "      <td>304</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Tomatillo Red Chili Salsa, [Fajita Vegetables...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3889</th>\n",
       "      <td>1559</td>\n",
       "      <td>2</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Fresh Tomato Salsa (Mild), [Black Beans, Rice...</td>\n",
       "      <td>16.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2384</th>\n",
       "      <td>948</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Roasted Chili Corn Salsa, [Fajita Vegetables,...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>781</th>\n",
       "      <td>322</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Fresh Tomato Salsa, [Black Beans, Cheese, Sou...</td>\n",
       "      <td>8.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2851</th>\n",
       "      <td>1132</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Roasted Chili Corn Salsa (Medium), [Black Bea...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1699</th>\n",
       "      <td>688</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Fresh Tomato Salsa, [Fajita Vegetables, Rice,...</td>\n",
       "      <td>11.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1395</th>\n",
       "      <td>567</td>\n",
       "      <td>1</td>\n",
       "      <td>Veggie Soft Tacos</td>\n",
       "      <td>[Fresh Tomato Salsa (Mild), [Pinto Beans, Rice...</td>\n",
       "      <td>8.49</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>4622 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      order_id  quantity          item_name  \\\n",
       "3389      1360         2  6 Pack Soft Drink   \n",
       "341        148         1  6 Pack Soft Drink   \n",
       "1849       749         1  6 Pack Soft Drink   \n",
       "1860       754         1  6 Pack Soft Drink   \n",
       "2713      1076         1  6 Pack Soft Drink   \n",
       "3422      1373         1  6 Pack Soft Drink   \n",
       "553        230         1  6 Pack Soft Drink   \n",
       "1916       774         1  6 Pack Soft Drink   \n",
       "1922       776         1  6 Pack Soft Drink   \n",
       "1937       784         1  6 Pack Soft Drink   \n",
       "3836      1537         1  6 Pack Soft Drink   \n",
       "298        129         1  6 Pack Soft Drink   \n",
       "1976       798         1  6 Pack Soft Drink   \n",
       "1167       481         1  6 Pack Soft Drink   \n",
       "3875      1554         1  6 Pack Soft Drink   \n",
       "1124       465         1  6 Pack Soft Drink   \n",
       "3886      1558         1  6 Pack Soft Drink   \n",
       "2108       849         1  6 Pack Soft Drink   \n",
       "3010      1196         1  6 Pack Soft Drink   \n",
       "4535      1803         1  6 Pack Soft Drink   \n",
       "4169      1664         1  6 Pack Soft Drink   \n",
       "4174      1666         1  6 Pack Soft Drink   \n",
       "4527      1800         1  6 Pack Soft Drink   \n",
       "4522      1798         1  6 Pack Soft Drink   \n",
       "3806      1525         1  6 Pack Soft Drink   \n",
       "2389       949         1  6 Pack Soft Drink   \n",
       "3132      1248         1  6 Pack Soft Drink   \n",
       "3141      1253         1  6 Pack Soft Drink   \n",
       "639        264         1  6 Pack Soft Drink   \n",
       "1026       422         1  6 Pack Soft Drink   \n",
       "...        ...       ...                ...   \n",
       "2996      1192         1       Veggie Salad   \n",
       "3163      1263         1       Veggie Salad   \n",
       "4084      1635         1       Veggie Salad   \n",
       "1694       686         1       Veggie Salad   \n",
       "2756      1094         1       Veggie Salad   \n",
       "4201      1677         1  Veggie Salad Bowl   \n",
       "1884       760         1  Veggie Salad Bowl   \n",
       "455        195         1  Veggie Salad Bowl   \n",
       "3223      1289         1  Veggie Salad Bowl   \n",
       "2223       896         1  Veggie Salad Bowl   \n",
       "2269       913         1  Veggie Salad Bowl   \n",
       "4541      1805         1  Veggie Salad Bowl   \n",
       "3293      1321         1  Veggie Salad Bowl   \n",
       "186         83         1  Veggie Salad Bowl   \n",
       "960        394         1  Veggie Salad Bowl   \n",
       "1316       536         1  Veggie Salad Bowl   \n",
       "2156       869         1  Veggie Salad Bowl   \n",
       "4261      1700         1  Veggie Salad Bowl   \n",
       "295        128         1  Veggie Salad Bowl   \n",
       "4573      1818         1  Veggie Salad Bowl   \n",
       "2683      1066         1  Veggie Salad Bowl   \n",
       "496        207         1  Veggie Salad Bowl   \n",
       "4109      1646         1  Veggie Salad Bowl   \n",
       "738        304         1  Veggie Soft Tacos   \n",
       "3889      1559         2  Veggie Soft Tacos   \n",
       "2384       948         1  Veggie Soft Tacos   \n",
       "781        322         1  Veggie Soft Tacos   \n",
       "2851      1132         1  Veggie Soft Tacos   \n",
       "1699       688         1  Veggie Soft Tacos   \n",
       "1395       567         1  Veggie Soft Tacos   \n",
       "\n",
       "                                     choice_description  item_price  \n",
       "3389                                        [Diet Coke]       12.98  \n",
       "341                                         [Diet Coke]        6.49  \n",
       "1849                                             [Coke]        6.49  \n",
       "1860                                        [Diet Coke]        6.49  \n",
       "2713                                             [Coke]        6.49  \n",
       "3422                                             [Coke]        6.49  \n",
       "553                                         [Diet Coke]        6.49  \n",
       "1916                                        [Diet Coke]        6.49  \n",
       "1922                                             [Coke]        6.49  \n",
       "1937                                        [Diet Coke]        6.49  \n",
       "3836                                             [Coke]        6.49  \n",
       "298                                            [Sprite]        6.49  \n",
       "1976                                        [Diet Coke]        6.49  \n",
       "1167                                             [Coke]        6.49  \n",
       "3875                                        [Diet Coke]        6.49  \n",
       "1124                                             [Coke]        6.49  \n",
       "3886                                        [Diet Coke]        6.49  \n",
       "2108                                             [Coke]        6.49  \n",
       "3010                                        [Diet Coke]        6.49  \n",
       "4535                                         [Lemonade]        6.49  \n",
       "4169                                        [Diet Coke]        6.49  \n",
       "4174                                             [Coke]        6.49  \n",
       "4527                                        [Diet Coke]        6.49  \n",
       "4522                                        [Diet Coke]        6.49  \n",
       "3806                                           [Sprite]        6.49  \n",
       "2389                                             [Coke]        6.49  \n",
       "3132                                        [Diet Coke]        6.49  \n",
       "3141                                         [Lemonade]        6.49  \n",
       "639                                         [Diet Coke]        6.49  \n",
       "1026                                           [Sprite]        6.49  \n",
       "...                                                 ...         ...  \n",
       "2996  [Roasted Chili Corn Salsa (Medium), [Black Bea...        8.49  \n",
       "3163  [[Fresh Tomato Salsa (Mild), Roasted Chili Cor...        8.49  \n",
       "4084  [[Fresh Tomato Salsa (Mild), Roasted Chili Cor...        8.49  \n",
       "1694  [[Fresh Tomato Salsa (Mild), Roasted Chili Cor...        8.49  \n",
       "2756  [[Tomatillo-Green Chili Salsa (Medium), Roaste...        8.49  \n",
       "4201  [Fresh Tomato Salsa, [Fajita Vegetables, Black...       11.25  \n",
       "1884  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "455   [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "3223  [Tomatillo Red Chili Salsa, [Fajita Vegetables...       11.25  \n",
       "2223      [Roasted Chili Corn Salsa, Fajita Vegetables]        8.75  \n",
       "2269  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...        8.75  \n",
       "4541  [Tomatillo Green Chili Salsa, [Fajita Vegetabl...        8.75  \n",
       "3293  [Fresh Tomato Salsa, [Rice, Black Beans, Chees...        8.75  \n",
       "186   [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "960   [Fresh Tomato Salsa, [Fajita Vegetables, Lettu...        8.75  \n",
       "1316  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...        8.75  \n",
       "2156  [Tomatillo Red Chili Salsa, [Fajita Vegetables...       11.25  \n",
       "4261  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "295   [Fresh Tomato Salsa, [Fajita Vegetables, Lettu...       11.25  \n",
       "4573  [Fresh Tomato Salsa, [Fajita Vegetables, Pinto...        8.75  \n",
       "2683  [Roasted Chili Corn Salsa, [Fajita Vegetables,...        8.75  \n",
       "496   [Fresh Tomato Salsa, [Rice, Lettuce, Guacamole...       11.25  \n",
       "4109  [Tomatillo Red Chili Salsa, [Fajita Vegetables...       11.25  \n",
       "738   [Tomatillo Red Chili Salsa, [Fajita Vegetables...       11.25  \n",
       "3889  [Fresh Tomato Salsa (Mild), [Black Beans, Rice...       16.98  \n",
       "2384  [Roasted Chili Corn Salsa, [Fajita Vegetables,...        8.75  \n",
       "781   [Fresh Tomato Salsa, [Black Beans, Cheese, Sou...        8.75  \n",
       "2851  [Roasted Chili Corn Salsa (Medium), [Black Bea...        8.49  \n",
       "1699  [Fresh Tomato Salsa, [Fajita Vegetables, Rice,...       11.25  \n",
       "1395  [Fresh Tomato Salsa (Mild), [Pinto Beans, Rice...        8.49  \n",
       "\n",
       "[4622 rows x 5 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chipo.item_name.sort_values()\n",
    "\n",
    "# OR\n",
    "\n",
    "chipo.sort_values(by = \"item_name\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 7. What was the quantity of the most expensive item ordered?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>order_id</th>\n",
       "      <th>quantity</th>\n",
       "      <th>item_name</th>\n",
       "      <th>choice_description</th>\n",
       "      <th>item_price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3598</th>\n",
       "      <td>1443</td>\n",
       "      <td>15</td>\n",
       "      <td>Chips and Fresh Tomato Salsa</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.25</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      order_id  quantity                     item_name choice_description  \\\n",
       "3598      1443        15  Chips and Fresh Tomato Salsa                NaN   \n",
       "\n",
       "      item_price  \n",
       "3598       44.25  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chipo.sort_values(by = \"item_price\", ascending = False).head(1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 8. How many times were a Veggie Salad Bowl ordered?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "18"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chipo_salad = chipo[chipo.item_name == \"Veggie Salad Bowl\"]\n",
    "\n",
    "len(chipo_salad)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 9. How many times people orderd more than one Canned Soda?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chipo_drink_steak_bowl = chipo[(chipo.item_name == \"Canned Soda\") & (chipo.quantity > 1)]\n",
    "len(chipo_drink_steak_bowl)"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
